<?php
namespace App\Controllers\Home;
use \App\Models\Home\User;
/**
*	设置用户
*/
class Weixinshare extends \App\Libs\Base\BaseAction
{
    protected function beforeRun() {
        parent::beforeRun();
        //$this->needLogin = TRUE;
    }
	
	public function execute(){
		$uri = 'http://517.augsky.com';
		$val = self::getSignature($uri);
	
			return \App\Libs\Views\Json::view(0, '成功授权',$val);	
		
		
	}
	
	 /**
        *       @Usage： 获取签名
        */
        public static function getSignature( $url = ""){
                if(empty($url)){
                        $url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
                }
                $token = self::token();
                $jsapi_ticket = self::getTicket();
                $noncestr = self::getGenerate(16);//16位随机数
                $time = time();
                $str = 'jsapi_ticket='.$jsapi_ticket.'&noncestr='.$noncestr.'&timestamp='.$time.'&url='.$url;
        $signatureSha1 =  sha1("jsapi_ticket=$jsapi_ticket&noncestr=$noncestr&timestamp=$time&url=$url");
                return ['signature'=>$signatureSha1,'time'=>$time,'ticket'=>$jsapi_ticket,'noncestr'=>$noncestr,'token'=>$token,'appID'=>self::$appID];
        }

	
	
}
